<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>url切割</title>
  </head>
  <body></body>
  <script>
    var cs = location.search;
    function urlQg(cs) {
      cs = cs.slice(1);
      var arr = cs.split("&");
      var obj = {};
      arr.forEach((v, k, a) => {
        a[k] = v.split("=");
        obj[a[k][0]] = a[k][1];
      });
      console.log(obj);
    }
    urlQg(cs);
  </script>
</html>
